<%@ page contentType="text/html;charset=utf-8" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>

<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>便民服务平台3.0</title>

</head>
<body>

<jsp:include page="../include/header.jsp"/>
<div class="main-container">
    <div class="mc-hd">

        <p class="query-t">queryCenter</p>
        <h1 class="query-h1">专注高端”互联网+政务”设计</h1>
        <div class="type-wrap">
            <h2 class="typedH2">慧眼看世界，在政务服务的路上不断追求创新！</h2>
        </div>

    </div>
    <div class="mc-bd">

        <div class="container">
            <div class="row">
                <div class="col-sm-3">
                    <div class="mccc-left">
                        <h2>便民查询</h2>
                        <ul class="nav nav-pills nav-stacked" role="tablist">
                            <li class="active"><a href="<c:url value='/taskbases/to_search' />">办理进度查询<i class="caret-right"></i></a></li>

                            <li><a href="<c:url value='/querys/names' />">重名查询<i class="caret-right"></i></a></li>
                        </ul>
                    </div>
                </div>
                <div class="col-sm-9">
                    <div class="mccc-right">
                        <h2>重名查询</h2>

                        <form class="form-horizontal" role="form"  method="get" name="searchForm" id="searchForm" action="">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">查询姓名：</label>
                                <div class="col-sm-7">
                                    <input type="text" maxlength="10" id="serchname" name="serchname" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">验证码：</label>
                                <div class="col-sm-4">
                                    <input type="text" id="valcode" name="valcode" class="form-control">
                                </div>
                                <div class="col-sm-2" id="validate_code">
                                    <a href="javascript:refeshCode()"><img  src="<c:url value='/simpleImg'/>" width="128"  height="34"></a>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-4">
                                    <input type="button"   class="btn btn-blue"  value="查询" onclick="callBackPagination();" />
                                    <input type="reset"   class="btn btn-default"  value="清空"  />
                                </div>
                            </div>
                        </form>

                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">查询结果</h3>
                            </div>
                            <div class="panel-body">
                                <div class="cmcx_cxjg">
                                    <div class="cmcx_cxjg_lf">
                                        <p class="text01" id="rezsval"></p>
                                        <p class="text02">重名人数</p>
                                    </div>
                                    <div class="cmcx_cxjg_rt" style="width: 640px;">
                                        <i class="cmcx_tit"></i>
                                        <p>查询姓名:<strong id="renameval"></strong></p>
                                     </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

<jsp:include page="../include/footer.jsp"/>

<script src="<c:url value='/resource/js/require.js'/>" data-main="<c:url value='/resource/js/main'/>" id="current-page" current-page ="queryCenter"></script>
<script src="<c:url value='/resource/js/lib/extendPagination.js'/>"></script>

<script type="text/javascript">
    function refeshCode(){
        var a = $("#validate_code");
        var src='<c:url value="/simpleImg?rand="/>'+Math.random();
        a.html("<a href='javascript:refeshCode()'><img src='"+src+"' width='128' height='34'></a>");
    }
    function callBackPagination() {

        var rename=$("#serchname").val();
        var recode=$("#valcode").val();
        if(rename == undefined || rename==''){//重名条件不能为空
            toast("姓名不能为空");
            return;
        }
        if(recode == undefined || recode==''){//验证码必须正确输入切不能不能为空
            toast("验证码不能为空");
            return ;
        }
        $.ajax({
            type: 'POST',
            url: "<c:url value='/taskbases/validatorCode'/>",
            data: {
                my_code: recode
            },
            success: function (res) {
                if(res.succ){
                    $.ajax({
                        url:"<c:url value='/querys/countnames'/>",
                        type: "POST",
                        data:{
                            name:rename
                        },
                        dataType: "json",
                        success: function(reps) {
                            $("#renameval").html($("#serchname").val());
                            $("#rezsval").html(reps.data);
                            refeshCode();
                        },
                        error:function(res){
                            toast(res.msg);
                        }
                    });
                }else{
                    toast(res.msg);
                }

            }
        });

    }

</script>

</body>
</html>








